package com.crm.miaohe.mapper;

import com.crm.miaohe.model.TblDepositDetails;
import com.crm.miaohe.model.TblDepositDetailsExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface TblDepositDetailsMapper {
    long countByExample(TblDepositDetailsExample example);

    int deleteByExample(TblDepositDetailsExample example);

    @Delete({
        "delete from tbl_deposit_details",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into tbl_deposit_details (customer_id, data_from, ",
        "amount, lock_amount, ",
        "change_type, create_time, ",
        "diff_amount, order_no, ",
        "create_user, update_time, ",
        "update_user, version)",
        "values (#{customerId,jdbcType=BIGINT}, #{dataFrom,jdbcType=VARCHAR}, ",
        "#{amount,jdbcType=DOUBLE}, #{lockAmount,jdbcType=DOUBLE}, ",
        "#{changeType,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{diffAmount,jdbcType=DOUBLE}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{updateUser,jdbcType=VARCHAR}, #{version,jdbcType=BIGINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(TblDepositDetails record);

    int insertSelective(TblDepositDetails record);

    List<TblDepositDetails> selectByExample(TblDepositDetailsExample example);

    @Select({
        "select",
        "id, customer_id, data_from, amount, lock_amount, change_type, diff_amount, order_no, create_time, create_user, ",
        "update_time, update_user, version",
        "from tbl_deposit_details",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("com.crm.miaohe.mapper.TblDepositDetailsMapper.BaseResultMap")
    TblDepositDetails selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") TblDepositDetails record, @Param("example") TblDepositDetailsExample example);

    int updateByExample(@Param("record") TblDepositDetails record, @Param("example") TblDepositDetailsExample example);

    int updateByPrimaryKeySelective(TblDepositDetails record);

    @Update({
        "update tbl_deposit_details",
        "set customer_id = #{customerId,jdbcType=BIGINT},",
          "data_from = #{dataFrom,jdbcType=VARCHAR},",
          "amount = #{amount,jdbcType=DOUBLE},",
          "lock_amount = #{lockAmount,jdbcType=DOUBLE},",
          "change_type = #{changeType,jdbcType=VARCHAR},",
          "diff_amount = #{diffAmount,jdbcType=DOUBLE},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "create_user = #{createUser,jdbcType=VARCHAR},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "update_user = #{updateUser,jdbcType=VARCHAR},",
          "version = #{version,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(TblDepositDetails record);
}